package pl.un4giv3n.mightvsmagic.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

/**
 * @author andrzejewskia user entity
 */
@Entity
public class UserStub implements Serializable {
	private static final long serialVersionUID = 1L;
	private Long id;
	private Long userId;
	private String login;
	/**
	 * user fight exp
	 */
	private long fightExp = 0;
	/**
	 * user magic exp
	 */
	private long magicExp = 0;
	/**
	 * user attributes (strenght,stamina etc)
	 */
	private long strenght;
	private long stamina;
	private long mana;
	private long attack;
	private long parry;
	private long life;
	/**
	 * user items
	 */
	private List<ItemStub> itemStubs = new ArrayList<ItemStub>();
	/**
	 * user hitpoints
	 */
	private double hp;
	private long speed;

	@SuppressWarnings("unused")
	private UserStub() {
		super();
	}

	public UserStub(String login, Long userId, long strenght, long attack, long parry,
			long life, long stamina, long mana, long speed, List<ItemStub> items, long magicExp, long fightExp) {
		super();
		this.login = login;
		this.userId = userId;
		this.strenght = strenght;
		this.attack = attack;
		this.parry = parry;
		this.life = life;
		this.stamina = stamina;
		this.mana = mana;
		this.speed = speed;
		this.itemStubs = items;
		this.fightExp = fightExp;
		this.magicExp = magicExp;
		hp = life * 10;
	}
	
	public String getLogin() {
		return login;
	}

	public void setLogin(String name) {
		this.login = name;
	}
	@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
	public List<ItemStub> getItems() {
		return itemStubs;
	}

	public void setItems(List<ItemStub> items) {
		this.itemStubs = items;
	}

	public long getFightExp() {
		return fightExp;
	}

	public void setFightExp(long fightExp) {
		this.fightExp = fightExp;
	}

	public long getMagicExp() {
		return magicExp;
	}

	public void setMagicExp(long magicExp) {
		this.magicExp = magicExp;
	}

	public double getHp() {
		return hp;
	}

	public void setHp(double hp) {
		this.hp = hp;
	}

	public long getStrenght() {
		return strenght;
	}

	public void setStrenght(long strenght) {
		this.strenght = strenght;
	}

	public long getStamina() {
		return stamina;
	}

	public void setStamina(long stamina) {
		this.stamina = stamina;
	}

	public long getMana() {
		return mana;
	}

	public void setMana(long mana) {
		this.mana = mana;
	}

	public long getAttack() {
		return attack;
	}

	public void setAttack(long attack) {
		this.attack = attack;
	}

	public long getParry() {
		return parry;
	}

	public void setParry(long parry) {
		this.parry = parry;
	}

	public long getLife() {
		return life;
	}

	public void setLife(long life) {
		this.life = life;
	}
	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public long getSpeed() {
		return speed;
	}

	public void setSpeed(long speed) {
		this.speed = speed;
	}

}
